@extends('admin.layout.main')
@section('content')
    <link rel="stylesheet" href="{{asset('/adminlte/plugins/bootstrap-iconpicker/icon-fonts/font-awesome-4.2.0/css/font-awesome.min.css')}}"/>
    <link rel="stylesheet" href="{{asset('/adminlte/plugins/bootstrap-iconpicker/bootstrap-iconpicker/css/bootstrap-iconpicker.min.css')}}"/>
    <section class="content-header">
      <h1>
        新增权限
      </h1>
      <ol class="breadcrumb">
        <li><a href="javascript:void(0)"><i class="fa fa-dashboard"></i> 权限管理</a></li>
        <li class="active"><a href="/admin/permissions">权限列表</a></li>
        <li class="active">新增权限</li>
      </ol>
    </section>
    <!-- Main content -->
    <section class="content">
        <!-- Small boxes (Stat box) -->
        <div class="row">
            <div class="col-lg-12 col-xs-6">
                <div class="box">
                    <!-- /.box-header -->
                    <div class="box box-primary">
                        <!-- /.box-header -->
                        <!-- form start -->
                        <form role="form" action="/admin/permissions/store" method="POST">
                            {{csrf_field()}}
                            <div class="box-body {{ $errors->has('name') ? ' has-error' : '' }}">
                                <div class="form-group">
                                    <label >权限规则</label>
                                    <input type="text" class="form-control" name="name" value="{{old('name')}}">
                                </div>
                            </div>
                            @if ($errors->has('name'))
                                <span class="help-block" style="color:#dd4b39">
                                   {{ $errors->first('name') }}
                                </span>
                            @endif                            
                            <div class="box-body {{ $errors->has('label') ? ' has-error' : '' }}">
                                <div class="form-group">
                                    <label >权限名称</label>
                                    <input type="text" class="form-control" name="label" value="{{old('label')}}">
                                </div>
                            </div>
                            @if ($errors->has('label'))
                                <span class="help-block" style="color:#dd4b39">
                                   {{ $errors->first('label') }}
                                </span>
                            @endif                            
                            <div class="box-body {{ $errors->has('description') ? ' has-error' : '' }}">
                                <div class="form-group">
                                    <label>权限描述</label>
                                    <input type="text" class="form-control" name="description" value="{{old('description')}}">
                                </div>
                            </div>
                            @if ($errors->has('description'))
                                <span class="help-block" style="color:#dd4b39">
                                   {{ $errors->first('description') }}
                                </span>
                            @endif
                           <div class="box-body {{ $errors->has('cid') ? ' has-error' : '' }}">
                                <div class="form-group">
                                    <label>所属</label>
                                    <select name="cid" class="form-control">
                                        <option value="">无</option>
                                        @foreach($permissions as $key => $val)
                                            <option value="{{$key}}">{{$val}}</option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>  
                            @if ($errors->has('cid'))
                                <span class="help-block" style="color:#dd4b39">
                                   {{ $errors->first('cid') }}
                                </span>
                            @endif 
                            <div class="box-body {{ $errors->has('icon') ? ' has-error' : '' }}">
                                <div class="form-group">
                                    <label>图标</label>
                                    <button class="btn btn-default" name="icon" data-iconset="fontawesome" data-icon="fa-sliders" role="iconpicker"></button>
                                </div>
                            </div>
                            @if ($errors->has('icon'))
                                <span class="help-block" style="color:#dd4b39">
                                   {{ $errors->first('icon') }}
                                </span>
                            @endif 
                            <!-- /.box-body -->
                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">提交</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <script type="text/javascript" src="{{asset('/adminlte/plugins/bootstrap-iconpicker/bootstrap-iconpicker/js/iconset/iconset-fontawesome-4.3.0.min.js')}}"></script>
    <script type="text/javascript" src="{{asset('/adminlte/plugins/bootstrap-iconpicker/bootstrap-iconpicker/js/bootstrap-iconpicker.js')}}"></script>
@endsection